﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TiposComuns.Objectos;
using System.Runtime.Remoting;

namespace Servidor.WebServices
{
    public class Server : MarshalByRefObject, IServer
    {
        #region IServidor Members

        #region Init
        public override object InitializeLifetimeService()
        {
            return null;
        }

        public State Connect(string username)
        {
            return Proxy.GetInstance().Connect(username);
        }

        public State GetState()
        {
            return Proxy.GetInstance().GetState();
        }

        #endregion

        #region Profile
        public Profile GetProfile()
        {
            return Proxy.GetInstance().GetProfile();
        }

        public State SetProfile(IDMsg id, Profile profile)
        {
            return Proxy.GetInstance().SetProfile(id,profile);
        }

        #endregion

        #region Posts
        public State Post(Post post)
        {
            return Proxy.GetInstance().Post(post);
        }

        public KeyValuePair<State, List<Post>> RefreshWall()
        {
            return Proxy.GetInstance().RefreshWall();
        }

        public List<Post> GetPosts()
        {
            return Proxy.GetInstance().GetPosts();
        }
        #endregion

        #region Friends

        public State FriendRequest(IDMsg id, Person target)
        {
            return Proxy.GetInstance().FriendRequest(id, target);
        }

        public State FriendAccept(IDMsg id, Person target)
        {
            return Proxy.GetInstance().FriendAccept(id, target);
        }

        public State FriendReject(IDMsg id, Person target)
        {
            return Proxy.GetInstance().FriendReject(id, target);
        }

        public State FriendRemove(IDMsg id, Person target)
        {
            return Proxy.GetInstance().FriendRemove(id, target);
        }
               

        public List<Person> GetFriends()
        {
            return Proxy.GetInstance().GetFriends();
        }

        public List<Person> GetFriendsReceived()
        {
            return Proxy.GetInstance().GetFriendsReceived();
        }

        public List<Person> GetFriendsSent()
        {
            return Proxy.GetInstance().GetFriendsSent();
        }

        #endregion

        #region Search

        public void StartLookupUsername(string username)
        {
            Proxy.GetInstance().StartLookupUsername(username);
        }

        public void StartLookup(string interest)
        {
            Proxy.GetInstance().StartLookupInterest(interest);
        }

        public void StartLookup(int ageMin, int ageMax, bool sex)
        {
            Proxy.GetInstance().StartLookupAgeSex(ageMin,ageMax, sex);
        }

        public KeyValuePair<List<Person>, bool> GetResults()
        {
            return Proxy.GetInstance().GetResults();
        }
        #endregion

        public State ChangeServer()
        {
            return Proxy.GetInstance().ChangeServer();
        }

        public Address GetAddress()
        {
            return Proxy.GetInstance().GetAddress();
        }
        #endregion
    }
}
